import hosts from "@/constants/hosts";

interface method {
  /** HTTP 请求 OPTIONS */
  OPTIONS;
  /** HTTP 请求 GET */
  GET;
  /** HTTP 请求 HEAD */
  HEAD;
  /** HTTP 请求 POST */
  POST;
  /** HTTP 请求 PUT */
  PUT;
  /** HTTP 请求 DELETE */
  DELETE;
  /** HTTP 请求 TRACE */
  TRACE;
  /** HTTP 请求 CONNECT */
  CONNECT;
}

export interface SingleApi {
  baseUrl: string;
  url: string;
  method: keyof method;
}

const apiMap = {
  commonCity: {
    baseUrl: hosts.baseUrl,
    url: "/common/citys",
    method: "GET",
  },
  indexFind: {
    baseUrl: hosts.baseUrl,
    url: "/index/find",
    method: "GET",
  },
  indexGetDetail: {
    baseUrl: hosts.baseUrl,
    url: "/index/getDetail",
    method: "POST",
  },
  index: {
    baseUrl: hosts.baseUrl,
    url: "/index",
    method: "POST",
  },
  addCount: {
    baseUrl: hosts.baseUrl,
    url: "/index/addCount",
    method: "POST",
  },
  addIndexCount: {
    baseUrl: hosts.baseUrl,
    url: "/index/addIndexCount",
    method: "GET",
  },
  authStore: {
    baseUrl: hosts.baseUrl,
    url: "/user/authStore",
    method: "POST",
  },
  getPlatformCount: {
    baseUrl: hosts.baseUrl,
    url: "/platform/getCount",
    method: "GET",
  },
  getCollection: {
    baseUrl: hosts.baseUrl,
    url: "/user/getCollection",
    method: "GET",
  },
  getPhone: {
    baseUrl: hosts.baseUrl,
    url: "/user/getPhone",
    method: "POST",
  },
  getUserInfo: {
    baseUrl: hosts.baseUrl,
    url: "/user/getUserInfo",
    method: "GET",
  },
  wxLogin: {
    baseUrl: hosts.baseUrl,
    url: "/user/getUserByCode",
    method: "GET",
  },
  useInfo: {
    baseUrl: hosts.baseUrl,
    url: "/user/info",
    method: "POST",
  },
  storeBiz: {
    baseUrl: hosts.baseUrl,
    url: "/user/storePperation",
    method: "POST",
  },
  getStoreDetail: {
    baseUrl: hosts.baseUrl,
    url: "/platform",
    method: "GET",
  },
  storeDelete: {
    baseUrl: hosts.baseUrl,
    url: "/platform",
    method: "DELETE",
  },
  addStore: {
    baseUrl: hosts.baseUrl,
    url: "/platform/addStore",
    method: "POST",
  },
  storeDisable: {
    baseUrl: hosts.baseUrl,
    url: "/platform/disable",
    method: "GET",
  },
  platformGetCount: {
    baseUrl: hosts.baseUrl,
    url: "/platform/getCount",
    method: "GET",
  },
  getStore: {
    baseUrl: hosts.baseUrl,
    url: "/platform/getStore",
    method: "POST",
  },
  getStoreViewCount: {
    baseUrl: hosts.baseUrl,
    url: "/platform/getStoreViewCount",
    method: "POST",
  },
  collectionStore: {
    baseUrl: hosts.baseUrl,
    url: "/store/collectionStore",
    method: "POST",
  },
  talkGet: {
    baseUrl: hosts.baseUrl,
    url: "/talk/getList",
    method: "POST",
  },
  talkPost: {
    baseUrl: hosts.baseUrl,
    url: "/talk",
    method: "POST",
  },
  talkDelete: {
    baseUrl: hosts.baseUrl,
    url: "/talk",
    method: "DELETE",
  },
  cooperationPlatformDetail: {
    baseUrl: hosts.baseUrl,
    url: "/cooperationPlatform",
    method: "GET",
  },
  addPlatform: {
    baseUrl: hosts.baseUrl,
    url: "/cooperationPlatform/addPlatform",
    method: "POST",
  },
  getPlatform: {
    baseUrl: hosts.baseUrl,
    url: "/cooperationPlatform/getPlatform",
    method: "POST",
  },
  cooperationPlatformDelete: {
    baseUrl: hosts.baseUrl,
    url: "/cooperationPlatform",
    method: "DELETE",
  },
  classify: {
    baseUrl: hosts.baseUrl,
    url: "/classify",
    method: "GET",
  },
  classifyPost: {
    baseUrl: hosts.baseUrl,
    url: "/classify",
    method: "POST",
  },
  // 删除分类
  classifyDelete: {
    baseUrl: hosts.baseUrl,
    url: "/classify",
    method: "DELETE",
  },
  // 添加首页广告
  classifyAddIndexPost: {
    baseUrl: hosts.baseUrl,
    url: "/classify/addIndex",
    method: "POST",
  },
  // 获取首页广告
  getIndexImage: {
    baseUrl: hosts.baseUrl,
    url: "/classify/getIndexImage",
    method: "GET",
  },
  //通过名称查询商家：添加分类时候获取商家id用
  getStoreByName: {
    baseUrl: hosts.baseUrl,
    url: "/classify/getStoreByName",
    method: "GET",
  },
  //获得全部分类
  classifyList: {
    baseUrl: hosts.baseUrl,
    url: "/classify/list",
    method: "GET",
  },
  //删除广告
  delAdvertisement: {
    baseUrl: hosts.baseUrl,
    url: "/classify/delAdvertisement",
    method: "DELETE",
  },
  //微信token
  getAccessToken: {
    baseUrl: hosts.wxUrl,
    url: "/cgi-bin/token",
    method: "GET",
  },
  //微信二维码
  getWxCode: {
    baseUrl: hosts.wxUrl,
    url: "/wxa/getwxacodeunlimit",
    method: "POST",
  },
  //新增广告
  insertAd: {
    baseUrl: hosts.baseUrl,
    url: "/indexAdvertisement",
    method: "POST",
  },
  //删除广告
  deleteAd: {
    baseUrl: hosts.baseUrl,
    url: "/indexAdvertisement",
    method: "DELETE",
  },
  getAd: {
    baseUrl: hosts.baseUrl,
    url: "/indexAdvertisement/getOpen",
    method: "GET",
  },
  updateAd: {
    baseUrl: hosts.baseUrl,
    url: "/indexAdvertisement",
    method: "PUT",
  },
  getQrCode: {
    baseUrl: hosts.baseUrl,
    url: "/user/getQrCode",
    method: "GET",
  },
  getAdList: {
    baseUrl: hosts.baseUrl,
    url: "/indexAdvertisement/list",
    method: "GET",
  },
};

export default apiMap;
